<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">


<!-- remove old header -->


<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>cogen API Reference Documentation
        - Module: async</title><meta name="MSSmartTagsPreventParsing" content="true" /><meta http-equiv="imagetoolbar" content="no" /><link href="css/default.css" rel="stylesheet" type="text/css" /><link href="css/pygments.css" rel="stylesheet" type="text/css" />
    <!-- <link rel="shortcut icon" href="/images/favicon.ico" type="image/vnd.microsoft.icon"/> -->
    <link rel="stylesheet" href="css/apydia.css" type="text/css" />
    <script src="js/jquery-1.2.1.pack.js" type="text/javascript"></script>
    <script src="js/apydia.js" type="text/javascript"></script>
	<link rel="icon" href="images/favicon.ico" type="image/x-icon" />
</head>
<body>
    <div id="page">
        <div id="browser">
            <div class="browser-section">
                <h2>Module Index</h2>
                <ul>
                    <li>
                        <a href="cogen.html">cogen</a>
                    </li><li>
                        <a href="cogen.common.html">cogen.common</a>
                    </li><li>
                        <a href="cogen.core.html">cogen.core</a>
                    </li><li>
                        <a href="cogen.core.coroutine.html">cogen.core.coroutine</a>
                    </li><li>
                        <a href="cogen.core.events.html">cogen.core.events</a>
                    </li><li>
                        <a href="cogen.core.queue.html">cogen.core.queue</a>
                    </li><li>
                        <a href="cogen.core.reactors.html">cogen.core.reactors</a>
                    </li><li>
                        <a href="cogen.core.schedulers.html">cogen.core.schedulers</a>
                    </li><li>
                        <a href="cogen.core.sockets.html">cogen.core.sockets</a>
                    </li><li>
                        <a href="cogen.core.util.html">cogen.core.util</a>
                    </li><li>
                        <a href="cogen.web.html">cogen.web</a>
                    </li><li class="active">
                        <a href="cogen.web.async.html">cogen.web.async</a>
                    </li><li>
                        <a href="cogen.web.wsgi.html">cogen.web.wsgi</a>
                    </li>
                </ul>
            </div>
            <div class="browser-section">
                <h2>Classes</h2>
                <ul>
                    <li>
                        <a href="cogen.web.async.COGENOperationCall.html">COGENOperationCall</a>
                    </li><li>
                        <a href="cogen.web.async.COGENOperationWrapper.html">COGENOperationWrapper</a>
                    </li><li>
                        <a href="cogen.web.async.COGENProxy.html">COGENProxy</a>
                    </li><li>
                        <a href="cogen.web.async.Read.html">Read</a>
                    </li><li>
                        <a href="cogen.web.async.ReadLine.html">ReadLine</a>
                    </li><li>
                        <a href="cogen.web.async.SynchronousInputMiddleware.html">SynchronousInputMiddleware</a>
                    </li>
                </ul>
            </div>
            <div class="browser-section">
                <h2>Functions</h2>
                <ul>
                    <li>
                        <a href="cogen.web.async.html#function-sync_input">sync_input</a>
                    </li>
                </ul>
            </div>
        </div>
        <div id="content">
    <h1>Module:
        cogen.web.async
    </h1>
    <div class="docstring plain">cogen.web.wsgi server is asynchronous by default. If you need to run a app that
uses wsgi.input synchronously you need to wrapp it in
<code name="code" class="python">SynchronousInputMiddleware</code>.<br /><br />Wsgi asynchronous api only provides a read operation at the moment. Here's a
example:<br /><br /><pre class="codeblock python python python python python python python python python python python python python python python python python python python python python python python python" name="code">
buff = StringIO()
while 1:
    yield environ['cogen.input'].Read(self.buffer_length)
    result = environ['cogen.wsgi'].result
    if isinstance(result, Exception):
        import traceback
        traceback.print_exception(*environ['cogen.wsgi'].exception)
        break
    else:
        if not result:
            break
        buff.write(result)
buff.seek(0)
# ...
# do something with the data
# ...
</pre></div>
    <ul class="link-bar">
    <li class="top"><a href="#header">Top</a></li>
    <li class="link-to-sourcecode">
        <a href="http://cogen.googlecode.com/svn/trunk/cogen\cogen\web\async.py#L1">View source</a>
    </li>
</ul>
    <div>
        <h2>Classes</h2>
            <h3>
                <a href="cogen.web.async.COGENOperationCall.html">COGENOperationCall</a>
            </h3>
            <div class="docstring plain"></div>
            <ul class="link-bar">
    <li class="top"><a href="#header">Top</a></li>
    <li>
        <a href="cogen.web.async.COGENOperationCall.html">Details</a>
    </li>
    <li class="link-to-sourcecode">
        <a href="http://cogen.googlecode.com/svn/trunk/cogen\cogen\web\async.py#L46">View source</a>
    </li>
</ul>
            <h3>
                <a href="cogen.web.async.COGENOperationWrapper.html">COGENOperationWrapper</a>
            </h3>
            <div class="docstring plain"></div>
            <ul class="link-bar">
    <li class="top"><a href="#header">Top</a></li>
    <li>
        <a href="cogen.web.async.COGENOperationWrapper.html">Details</a>
    </li>
    <li class="link-to-sourcecode">
        <a href="http://cogen.googlecode.com/svn/trunk/cogen\cogen\web\async.py#L33">View source</a>
    </li>
</ul>
            <h3>
                <a href="cogen.web.async.COGENProxy.html">COGENProxy</a>
            </h3>
            <div class="docstring plain"></div>
            <ul class="link-bar">
    <li class="top"><a href="#header">Top</a></li>
    <li>
        <a href="cogen.web.async.COGENProxy.html">Details</a>
    </li>
    <li class="link-to-sourcecode">
        <a href="http://cogen.googlecode.com/svn/trunk/cogen\cogen\web\async.py#L53">View source</a>
    </li>
</ul>
            <h3>
                <a href="cogen.web.async.Read.html">Read</a>
            </h3>
            <div class="docstring plain">This is actually a hack that mixes ReadAll and ReadLine and
patches their state attributes. Hopefully i'll evolve it to
something more elegant at some point.</div>
            <ul class="link-bar">
    <li class="top"><a href="#header">Top</a></li>
    <li>
        <a href="cogen.web.async.Read.html">Details</a>
    </li>
    <li class="link-to-sourcecode">
        <a href="http://cogen.googlecode.com/svn/trunk/cogen\cogen\web\async.py#L97">View source</a>
    </li>
</ul>
            <h3>
                <a href="cogen.web.async.ReadLine.html">ReadLine</a>
            </h3>
            <div class="docstring plain">Same a async.Read but doesn't work with chunked input (it would complicate
things too much at the moment).</div>
            <ul class="link-bar">
    <li class="top"><a href="#header">Top</a></li>
    <li>
        <a href="cogen.web.async.ReadLine.html">Details</a>
    </li>
    <li class="link-to-sourcecode">
        <a href="http://cogen.googlecode.com/svn/trunk/cogen\cogen\web\async.py#L254">View source</a>
    </li>
</ul>
            <h3>
                <a href="cogen.web.async.SynchronousInputMiddleware.html">SynchronousInputMiddleware</a>
            </h3>
            <div class="docstring plain">Middleware for providing wsgi.input to the app.</div>
            <ul class="link-bar">
    <li class="top"><a href="#header">Top</a></li>
    <li>
        <a href="cogen.web.async.SynchronousInputMiddleware.html">Details</a>
    </li>
    <li class="link-to-sourcecode">
        <a href="http://cogen.googlecode.com/svn/trunk/cogen\cogen\web\async.py#L58">View source</a>
    </li>
</ul>
    </div>
    <div>
        <h2>Functions</h2>
            <h3 id="function-sync_input">
                sync_input
                <span class="args">(app)</span>
            </h3>
            <div class="docstring plain"></div>
            <ul class="link-bar">
    <li class="top"><a href="#header">Top</a></li>
    <li class="link-to-sourcecode">
        <a href="http://cogen.googlecode.com/svn/trunk/cogen\cogen\web\async.py#L94">View source</a>
    </li>
</ul>
    </div>
        </div>
        <div id="footer">
            Generated with <a href="http://apydia.ematia.de/" class="extern">
            Apydia 0.0.3</a>
        </div>
    </div>
</body>
</html>